<?php
namespace App\Models;

use App\Models\Scope\NewsScope;

class News extends CommonModel {
	protected $table = 'news';
	
	public static function boot()
	{
		parent::boot();
		static::addGlobalScope(new NewsScope());
	}
	
	/**
	 * @param $query
	 * @return mixed
	 * 只显示基本字段，无详情字段，多用户列表展示
	 */
	public function scopeList($query){
		return $query->select(['id','name','image','url','viewed_count','remarks','status','created_at','updated_at']);
	}
}